<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>vtable1k</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="OpcodesTop.html" title="Orchestra Opcodes and Operators" />
    <link rel="prev" href="vsubv_i.html" title="vsubv_i" />
    <link rel="next" href="vtablei.html" title="vtablei" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">vtable1k</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="vsubv_i.html">Prev</a> </td>
          <th width="60%" align="center">Orchestra Opcodes and Operators</th>
          <td width="20%" align="right"> <a accesskey="n" href="vtablei.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="refentry">
      <a id="vtable1k"></a>
      <div class="titlepage"></div>
      <a id="IndexVtable1k" class="indexterm"></a>
      <div class="refnamediv">
        <h2>
          <span class="refentrytitle">vtable1k</span>
        </h2>
        <p>vtable1k — 
     Read a vector (several scalars simultaneously) from a table.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp166829008"></a>
        <h2>Description</h2>
        <p>
      This opcode reads vectors from tables at k-rate.
    </p>
      </div>
      <div class="refsect1">
        <a id="idp166830336"></a>
        <h2>Syntax</h2>
        <pre class="synopsis"><span class="command"><strong>vtable1k</strong></span>  kfn,kout1 [, kout2, kout3, .... , koutN ]</pre>
      </div>
      <div class="refsect1">
        <a id="idp166832944"></a>
        <h2>Performance</h2>
        <p>
      <span class="emphasis"><em>kfn</em></span> - table number
     </p>
        <p>
      <span class="emphasis"><em>kout1...koutN</em></span> - output vector elements
    </p>
        <p>
      <span class="emphasis"><em>vtable1k</em></span> is a reduced version of <a class="link" href="vtablek.html" title="vtablek"><em class="citetitle">vtablek</em></a>, it only allows to access the first vector (it is equivalent to vtablek with kndx = zero, but a bit faster). It is useful to easily and quickly convert a set of values stored in a table into a set of k-rate variables to be used in normal opocodes, instead of using individual <a class="link" href="table.html" title="table"><em class="citetitle">table</em></a> opcodes for each value.
    </p>
        <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
          <table border="0" summary="Note">
            <tr>
              <td rowspan="2" align="center" valign="top" width="25">
                <img alt="[Note]" src="images/note.png" />
              </td>
              <th align="left">Note</th>
            </tr>
            <tr>
              <td align="left" valign="top">
                <p>
        <span class="emphasis"><em>vtable1k</em></span> is an unusual opcode as it produces its output on the right side arguments of the opcode.
      </p>
              </td>
            </tr>
          </table>
        </div>
      </div>
      <div class="refsect1">
        <a id="idp166839872"></a>
        <h2>Examples</h2>
        <p>
      Here is an example of the vtable1k opcode. It uses the files <a class="ulink" href="examples/vtable1k.csd" target="_top"><em class="citetitle">vtable1k.csd</em></a>.

      </p>
        <div class="example">
          <a id="idp166841648"></a>
          <p class="title">
            <strong>Example 1031. Example of the vtable1k opcode.</strong>
          </p>
          <div class="example-contents">
            <pre class="programlisting">
<span class="csdtag">&lt;CsoundSynthesizer&gt;</span>
<span class="csdtag">&lt;CsOptions&gt;</span>
<span class="comment">; Select audio/midi flags here according to platform</span>
<span class="comment">; Audio out   Audio in    No messages</span>
-odac           -iadc     -d     <span class="comment">;;;RT audio I/O</span>
<span class="csdtag">&lt;/CsOptions&gt;</span>
<span class="csdtag">&lt;CsInstruments&gt;</span>

<span class="ohdr">sr</span>	<span class="op">=</span>	44100
<span class="ohdr">ksmps</span>	<span class="op">=</span>	100
<span class="ohdr">nchnls</span>	<span class="op">=</span>	2

giElem	<span class="opc">init</span>	13
giOutTab	<span class="ohdr">ftgen</span>	1,0,128, 2, 	0
giFreqTab	<span class="ohdr">ftgen</span>	2,0,128,<span class="op">-</span>7, 	1,giElem, giElem<span class="op">+</span>1
giSine	<span class="ohdr">ftgen</span>	3,0,256,10,	1

	<span class="opc">FLpanel</span>	"This Panel contains <span class="opc">a</span> Slider Bank",500,400
	<span class="opc">FLslidBnk</span>	"mod1@mod2@mod3@amp@freq1@freq2@freq3@freqPo", giElem, giOutTab, 360, 600, 100, 10
	<span class="opc">FLpanel_end</span>

	<span class="opc">FLrun</span>

	<span class="oblock">instr</span> 1

kout1	<span class="opc">init</span>	0
kout2	<span class="opc">init</span>	0
kout3	<span class="opc">init</span>	0
kout4	<span class="opc">init</span>	0
kout5	<span class="opc">init</span>	0
kout6	<span class="opc">init</span>	0
kout7	<span class="opc">init</span>	0
kout8	<span class="opc">init</span>	0

<span class="opc">vtable1k</span>  giOutTab, kout1 , kout2, kout3, kout4, kout5 , kout6, kout7, kout8
kmodindex1<span class="op">=</span> 	2 <span class="op">*</span> <span class="opc">db</span>(kout1 <span class="op">*</span> 80 )
kmodindex2<span class="op">=</span>	2 <span class="op">*</span> <span class="opc">db</span>(kout2 <span class="op">*</span> 80 )
kmodindex3<span class="op">=</span>	2 <span class="op">*</span> <span class="opc">db</span>(kout3 <span class="op">*</span> 80 )
kamp	<span class="op">=</span>	50 <span class="op">*</span> <span class="opc">db</span>(kout4 <span class="op">*</span> 70 )
kfreq1	<span class="op">=</span>	1.1 <span class="op">*</span> <span class="opc">octave</span>(kout5 <span class="op">*</span> 10)
kfreq2	<span class="op">=</span>	1.1 <span class="op">*</span> <span class="opc">octave</span>(kout6 <span class="op">*</span> 10) 
kfreq3	<span class="op">=</span>	1.1 <span class="op">*</span> <span class="opc">octave</span>(kout7 <span class="op">*</span> 10)
kfreq4	<span class="op">=</span>	30 <span class="op">*</span> <span class="opc">octave</span>(kout8 <span class="op">*</span> 8)

amod1	<span class="opc">oscili</span>	kmodindex1, kfreq1, giSine
amod2	<span class="opc">oscili</span>	kmodindex2, kfreq2, giSine
amod3	<span class="opc">oscili</span>	kmodindex3, kfreq3, giSine
aout	<span class="opc">oscili</span>	kamp,       kfreq4<span class="op">+</span>amod1<span class="op">+</span>amod2<span class="op">+</span>amod3, giSine

	
	<span class="opc">outs</span>	aout, aout
	<span class="oblock">endin</span>


<span class="csdtag">&lt;/CsInstruments&gt;</span>
<span class="csdtag">&lt;CsScore&gt;</span>

<span class="stamnt">i</span>1 0 3600
<span class="stamnt">f</span>0 3600

<span class="csdtag">&lt;/CsScore&gt;</span>
<span class="csdtag">&lt;/CsoundSynthesizer&gt;</span>
</pre>
          </div>
        </div>
        <p><br class="example-break" />
    </p>
      </div>
      <div class="refsect1">
        <a id="idp166843568"></a>
        <h2>See Also</h2>
        <p>
      <a class="link" href="vtablek.html" title="vtablek"><em class="citetitle">vtablek</em></a>
    </p>
      </div>
      <div class="refsect1">
        <a id="idp166845680"></a>
        <h2>Credits</h2>
        <p>Written by Gabriel Maldonado.</p>
        <p>New in Csound 5.06</p>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="vsubv_i.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="OpcodesTop.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="vtablei.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">vsubv_i </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> vtablei</td>
        </tr>
      </table>
    </div>
  </body>
</html>
